package one.three.fortyFive;

public class StackGenerality {

	public static boolean valid(String[] a) {
		int c = 0;
		for (int i = 0; i < a.length; i++) {
			if (a[i].matches("[0-9]+")) {
				c++;
			}
			if (a[i].equals("-")) {
				c--;
			}
		}
		return c == 0;
	}

	public static void main(String[] args) {
		String[] a = { "0", "-", "1", "2", "-" };
		System.out.println(valid(a));
	}

}
